package com.cloudbench.common.wz;

import android.app.AlertDialog;
import android.app.ProgressDialog;
import android.content.Context;

/**
 * 
 * @Author : justin
 * @Date : Jun 7, 2012 12:06:46 PM
 * @Version : 1.0.0
 */
public class ProgressDialogFactory {

	static final String loading ="Loading...";
	private static int style = AlertDialog.THEME_HOLO_DARK;
	
	/**
	 * Create ProgressDialog
	 * @param c
	 * @param cancelable
	 * @return
	 */
	public static ProgressDialog create(Context c, boolean cancelable) {
		return create(c, "", loading, cancelable);		
	}
	
	/**
	 * Create ProgressDialog
	 * @param c
	 * @param title
	 * @param message
	 * @param cancelable
	 * @return
	 */
	public static ProgressDialog create(Context c, String title, String message, boolean cancelable) {
		ProgressDialog dialog = new ProgressDialog(c, style);

		dialog.setTitle(title);		
		dialog.setMessage(message);
		dialog.setCancelable(cancelable);
		dialog.setCanceledOnTouchOutside(false);		
		return dialog;
	}

	/**
	 * Create ProgressDialog
	 * @param c
	 * @param start
	 * @param max
	 * @param cancelable
	 * @return
	 */
//	public static ProgressDialog create(Context c, int start, int max, boolean cancelable) {
//		ProgressDialog dialog = new HidedNumberProgressDialog(c); // ProgressDialog(c);
//		dialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
//		dialog.setProgress(start);
//		dialog.setMax(max);
//		dialog.setCancelable(cancelable);
//		dialog.setCanceledOnTouchOutside(false);
//		
//		return dialog;		
//	} 

	public static ProgressDialog create(Context c, String title, String message, int start, int max, boolean cancelable) {
		ProgressDialog dialog = new ProgressDialog(c);
		dialog.setTitle(title);		
		dialog.setMessage(message);
		dialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
		dialog.setProgress(start);
		dialog.setMax(max);
		dialog.setCancelable(cancelable);
		dialog.setCanceledOnTouchOutside(false);
		
		return dialog;		
	}
	
}
